package linkedlistsetcode;

import bstsetcode.FileOperation;

import java.util.ArrayList;

/**
 * @author noob
 * @version 1.0
 * @date 2021/3/18 10:10
 */
public class MainTest {
    public static void main(String[] args) {

        System.out.println("working directory:" + System.getProperty("user.dir"));
        //working directory:E:\play_bobobo  所以文件要放到这里？ yes
        System.out.println("Pride and Prejudice");
        ArrayList<String> words1 = new ArrayList<>();
        if(FileOperation.readFile("pride-and-prejudice.txt", words1)) {
            System.out.println("Total words: " + words1.size());

            LinkedListSet<String> set1 = new LinkedListSet<>();
            for (String word : words1)
                set1.add(word);
            System.out.println("Total different words: " + set1.getSize());
        }

        System.out.println();

        ArrayList<String> words2 = new ArrayList<>();
        if(FileOperation.readFile("a-tale-of-two-cities.txt", words2)){
            System.out.println("Total words: " + words2.size());

            LinkedListSet<String> set2 = new LinkedListSet<>();
            for(String word: words2)
                set2.add(word);
            System.out.println("Total different words: " + set2.getSize());
        }
    }
}
